#!/bin/sh
#-------------------------------------------------------------------------------
#
# Setup script for low-level Spinnaker work
#
#-------------------------------------------------------------------------------

# Copyright (c) 2017-2019 The University of Manchester
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

set -a

#-------------------------------------------------------------------------------

# This file should be sourced, not executed!
if [ "$0" == "${BASH_SOURCE[0]}" ]; then
  echo "WARNING: $0 should be sourced, not executed. Try: source $0"
fi

#-------------------------------------------------------------------------------

# SPINN_DIRS should point to the directory containing subdirs "tools",
# "lib", "include", etc. It's used by many tools to locate resources.
# used during the building of SpiNNaker applications. The subdirectory
# "tools" contains locally developed tools for building applications.

SPINN_DIRS=`cd "$(dirname "${BASH_SOURCE[0]}")";pwd -P`

#-------------------------------------------------------------------------------

# SPINN_PATH is a path variable (elements separated by ":"). It's used
# to find resources used while building and running applications. It
# should always contain at least the "tools/boot" directory of $SPINN_DIRS

SPINN_PATH=$SPINN_DIRS/tools/boot

#-------------------------------------------------------------------------------

# Add the "tools" directory to the Unix PATH and to the Perl library
# search path.

PATH=$SPINN_DIRS/tools:$PATH

PERL5LIB=$SPINN_DIRS/tools:$PERL5LIB

#-------------------------------------------------------------------------------

# Set up variables pointing to the ARM software development tools
# These tools need a licence file so set that up as well. You may need
# to edit this section for your local environment

# *** EDIT HERE ***

ARMTOOLS=/home/amulinks/spinnaker/tools/RVDS40

ARMBIN=$ARMTOOLS/RVCT/Programs/4.0/400/linux-pentium
ARMLIB=$ARMTOOLS/RVCT/Data/4.0/400/lib
ARMINC=$ARMTOOLS/RVCT/Data/4.0/400/include/unix

LM_LICENSE_FILE=PORT@SERVER.cs.man.ac.uk:$LM_LICENSE_FILE

#-------------------------------------------------------------------------------

# Set up variables pointing to the GNU software development tools.
# You may need to edit this section for your local environment

# *** EDIT HERE ***

GNUTOOLS=/local/temples/gcc-arm-none-eabi-4_9-2015q3

GNUBIN=$GNUTOOLS/bin

#-------------------------------------------------------------------------------

# Finally, add ARM and GNU software development tools to the PATH

PATH=$GNUBIN:$ARMBIN:$PATH

#-------------------------------------------------------------------------------


chmod u+x $SPINN_DIRS/tools/*

